<!--#include file="Config.asp" -->
<!--#include file="HeadTop.asp"-->
<%


intID=int(Request("id"))
ActionType=Trim(Request("ActionType"))
SaveType=Trim(Request("SaveType"))
strdate=Trim(Request("currentDate"))
msg=request("msg")


If strdate="" Then
strdate=Date()
Else
strdate=strdate
End If

set rs=server.createobject("adodb.recordset")
'SaveAdd
if SaveType="AddOK" then
sql="select * from plan_calendar where id is null"
rs.open sql,conn,1,3
rs.addnew
rs("calendarDate")=strdate
rs("UserID")=session("AnyPIM_userID")
rs("calendarTitle")=Trim(Request("Title"))
rs("calendarText")=Trim(Request("Content"))
rs("calendarTime")=Now()
rs("calendarFlag")=Trim(Request("calendarFlag"))
rs("calendarFinType")=Trim(Request("calendarFinType"))
rs("calendarRight")=Trim(Request("calendarRight"))
rs("calendarHour")=Trim(Int(Request("calendarHour")))
rs("calendarMPlan")=Trim(Int(Request("calendarMPlan")))
rs("calendarsort")=Trim(Int(Request("calendarsort")))
rs.Update
rs.close
msg="添加成功！"

end if

'增加数据开始----------------------------------------------------------------
'Add
if ActionType="Add" or ActionType="" then
AName="填写完整，提交"
URL_This="?SaveType=AddOK"

%>
<TABLE class="table table-condensed">
<TR>
<!-- main ///////////////////////////////////////////////////////////////////////////////////////////-->
<form method="post" action="<%=URL_This%>" name="form1">
<TD valign='top'>
<TABLE  width="100%" border="0" cellpadding="2" cellspacing="1"bgcolor='#ddeeff' style="FILTER: progid:DXImageTransform.Microsoft.Gradient(startColorStr='#ddeeff', endColorStr='#FFFFFF', gradientType='0');" align='center'>
<TR>
<TD align='right'>时间：</TD>
<TD>
<INPUT TYPE="text" NAME="currentDate" value='<%=strdate%>' class="Wdate" onClick="WdatePicker()">
<SELECT NAME="calendarHour">
<%For ch=WT_begin To WT_End%><OPTION VALUE="<%=ch%>" <%If Hour(Now())=ch then%>SELECTED<%End if%>><%=ch%>点</option>
 <%next%></SELECT>
<SELECT NAME="calendarsort">
<%
SQL="select * from Plan_sort order by ID"
rs.open sql,conn,1,1
For s=1 To rs.recordcount
%>
<OPTION VALUE="<%=rs("id")%>"><%=trim(rs("Title"))%></OPTION>
<%
rs.moveNext
next
rs.close
%>
</SELECT>
</TD>
</tr>
<TR>
<TD align='right'>事件标题：</TD>
<TD>
<INPUT TYPE="text" NAME="title" value='6w' size='60'>
</TD>
</tr>
<TR>
<TD align='right'>事件内容：</TD>
<TD>
<!--  HTML编辑器 eWebEditor V9.20精简版引用------------->
<textarea name="content" style="display:none" id="content" >When:<%=Now()%><BR>Who:<BR>What:<BR>Where:<BR>How:<BR>SWOT:<BR>PDCA:<BR>收获:<BR>缺失:<BR>改进之处:<BR>注意点:<BR>平衡计分卡：</textarea>
<IFRAME ID="eWebEditor1" src="_Editor/ewebeditor.asp?id=content&style=s_exampleremote" FRAMEBORDER="0" scrolling="no" width="100%" HEIGHT="350"></iframe>
<!--  HTML编辑器 eWebEditor V9.20精简版引用-------------></TD>
</tr>
<TR>
<TD align='right'>所为目标：</TD>
<TD>
<%
'月度目标
SQL="select * from Plan_target where '"&strdate&"' between T_begin_time and T_End_time and T_Father_ID=0 and UserID='"&session("AnyPIM_userID")&"' order by T_ID"
rs.open sql,conn,1,1
TargetNum=rs.recordcount
If TargetNum<>0 then
%>
<SELECT NAME="calendarMPlan">
<%

For Y=1 To rs.recordcount
%>
<optgroup label="<%=y%>.<%=Trim(rs("T_Title"))%>">
<%
SQL2="select * from Plan_target where '"&strdate&"' between T_begin_time and T_End_time and T_Father_ID="&int(rs("T_ID"))&" and UserID='"&session("AnyPIM_userID")&"' order by T_ID"
rss.open sql2,conn,1,1
For YS=1 To rss.recordcount
%>
<OPTION VALUE="<%=int(rss("T_ID"))%>" style= "background:<%=ShowFlagColor(trim(rss("T_Flag")))%>" <%If MPlan=Trim(rss("T_ID")) Then %>selected<%End if%>><%=y%>.<%=ys%>.<%=Trim(rss("T_Title"))%></OPTION>
<%
rss.moveNext
next
rss.close
%>
</optgroup>
<%
rs.moveNext
next
%>
</SELECT>
<%else%>
<a href="ObjectiveTreeAdmin.ASP">请<%=session("AnyPIM_userName")%>先添加目标</a>
<%
End If
rs.close
%>


优先级：
<SELECT NAME="calendarFlag">
<%
SQL="select * from Plan_flag order by ID"
rs.open sql,conn,1,1
For s=1 To rs.recordcount
%>
<OPTION VALUE="<%=Int(rs("id"))%>" <%If Int(rs("id"))=4 then%>SELECTED<%End if%>><%=Int(rs("id"))%>.<%=trim(rs("title"))%></OPTION>
<%
rs.moveNext
next
rs.close
%>

</SELECT>
完成程度：
<SELECT NAME="calendarFinType">
<%For Fi=10 To 0 step -1%>
<OPTION VALUE="<%=Fi%>" <%If Fi=9 then%>selected<%End if%>><%=10*Fi%>%</option>
<%next%>
</SELECT>
权限：
<SELECT NAME="calendarRight">
<OPTION VALUE="2" SELECTED>公开</option>
<OPTION VALUE="1">私人</option>
</SELECT>
</TD>
</tr>
</TABLE>
<%
'AnyPIM_Free_Right权限检测
If session("AnyPIM_RightAdd")=1 And TargetNum<>0 then
%>
<br>
<CENTER><INPUT TYPE="SUBMIT" VALUE="<%=AName%>" class="as01">
<INPUT TYPE="reset">
<FONT color="#ff0000"><B><%=msg%></B></FONT></CENTER>
<%
Else
%>
<br><br />
<CENTER>无法保存的原因：1.请联系有管理权限的用户变更添加权限，2.之后，需<a href="ObjectiveTreeAdmin.ASP">添加目标</a></CENTER>
<%
End if
%>
</TD>
</FORM>
<!-- Right /////////////////////////////////////////////////////////////////////////-->
<TD valign='top' width='250'>
<!-- 今日信息开始 -->
<!-- #include file="IncEventTodayMsg.asp" -->
<!-- 今日信息结束 -->
<!-- 期间目标和安排 -->
<!-- #include file="IncEventObjective.asp" -->
<!-- 期间目标和安排 -->
</TD>
</TR>
</TABLE>

<%
End if
%>


<!-- #include file="foot.asp" -->
